package org.amse.tanks.model;

import java.io.Serializable;

public class Map implements Serializable {
    private int[][] myMap;

    public Map() {
        int[][] Map = null;
            /*{
                {0,0,0,0,0,0,1,1,1,1,1,1,1,1,1},
                {0,0,0,0,0,0,1,1,1,1,1,1,1,1,1},
                {0,0,0,0,0,0,1,1,1,1,1,1,1,1,1},
                {1,1,1,0,0,0,0,0,0,0,0,0,0,0,0},
                {1,1,1,0,0,0,0,0,0,0,0,0,0,0,0},
                {1,1,1,0,0,0,0,0,0,0,0,0,0,0,0},
                {0,0,0,0,0,0,1,1,1,1,1,1,0,0,0},
                {0,0,0,0,0,0,1,1,1,1,1,1,0,0,0},
                {0,0,0,0,0,0,1,1,1,1,1,1,0,0,0},
                {1,1,1,0,0,0,1,1,1,0,0,0,0,0,0},
                {1,1,1,0,0,0,1,1,1,0,0,0,0,0,0},
                {1,1,1,0,0,0,1,1,1,0,0,0,0,0,0},
                {1,1,1,0,0,0,1,1,1,0,0,0,1,1,1},
                {1,1,1,0,0,0,1,1,1,0,0,0,1,1,1},
                {1,1,1,0,0,0,1,1,1,0,0,0,1,1,1},
                {1,1,1,0,0,0,1,1,1,0,0,0,1,1,1}
               };*/
        myMap = Map;
    }

    public int getWidth() {
        if (myMap == null)  {
            return 0;
        }
        return myMap[0].length;
    }

    public int getHeight() {
        if (myMap == null)  {
            return 0;
        }
        return myMap.length;
    }

    public int getValue(int x, int y) {
        //stub
        if (x >= getWidth() || x < 0 || y >= getHeight() || y < 0) {
            return -1;
        }
        return myMap[y][x];
    }

    public void setSize(int width, int height) {
        myMap = new int[height][width];
    }

    public void setValue(int x, int y, int value) {
        myMap[y][x] = value;
    }
}
